#pragma comment(linker, "/STACK:10000000")
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <cstdio>
#include <cassert>
#include <string>
#include <cstring>
#define ldb long double
#define ll long long
#define fi first
#define se second
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define fill(a, c) memset(a, c, sizeof(a))
#define sqr(a) ((a) * (a))
#define nextLine() {int c = 0; while((c = getchar()) != 10 && c != EOF);}
#define getBit(mask, k) (((mask) / pw[k]) % pw[1])
#define setBit(mask, k, l) (((mask) / pw[k + 1] * pw[1] + (l)) * pw[k] + ((mask) % pw[k]))
#define debug(a) cerr << #a << " = " << (a) << " ";
#define debugl(a) cerr << #a << " = " << (a) << "\n";
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define ff first
#define ss second 
const ldb eps = 1e-9;
const int inf = 1 << 28;
const ldb pi = fabsl(atan2l(0.0, -1.0));
using namespace std;


map <ll, int> was;
const ll mod = 1000000007ll;
ll N, K, M;

void load()
{
	cin >> N >> K >> M;
}

ll solve_dull()
{
	ll f0 = N, f1;
	ll k = K;
	for (int i = 1; i <= M; i++)
	{
		f1 = ((1 + k) * f0) % mod;
		f1 -= k;
		f1 %= mod;
		f0 = f1;
		k *= k;
		k %= mod;
	}
	f0 += mod;
	f0 %= mod;
	return f0;
}

ll solve_dull2()
{
	ll f0 = N, f1;
	ll k = K;
	for (int i = 1; i <= M; i++)
	{
		f1 = (f0 + k * (N - 1)) % mod;
		f0 = f1;
		k *= K;
		k %= mod;
	}
	f0 += mod;
	f0 %= mod;
	return f0;
}


ll fastPowMod(ll a, ll power, ll mod)
{
	ll d = 1;
	for (;power; power >>= 1)
	{
		if (power & 1)
			d = (d * a) % mod;
		a = (a * a) % mod;
	}
	return d;
}

ll invMod(ll a)
{
	return fastPowMod(a, mod - 2, mod);
}

ll solve()
{
	if (K == 1)
	{
		return (1 + (((N - 1) * fastPowMod(2, M, mod)) % mod)) % mod;
	}
	ll result = ((N - 1) * invMod(K - 1)) % mod;
	result *= (fastPowMod(K, fastPowMod(2, M, mod - 1), mod) - 1) % mod;
	result %= mod;
	result ++;
	result %= mod;
	return result;
}

ll solve2()
{
	if (K == 1)
	{
		return ((M + 1) * (N - 1) + 1) % mod;
	}
	ll result = ((N - 1) * invMod(K - 1)) % mod;
	result *= (fastPowMod(K, M + 1, mod) - 1) % mod;
	result ++;
	result %= mod;
	return result;
}
                  
#define file "fir"
int main()
{
	freopen(file".in", "rt", stdin);
	freopen(file".out", "wt", stdout);
	load();
//	cout << solve_dull2() << " ";
	cout << solve2();
	return 0;
}
